CC = g++
CFLAGS = -Wall -g

SRCDIR = src
BUILDDIR = build
INCDIR = include

SOURCES := $(wildcard $(SRCDIR)/*.cpp)
OBJECTS := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SOURCES))

TARGET = $(BUILDDIR)/my_program

$(TARGET):$(OBJECTS)
	$(CC) $(CFLAGS) -o $@ $^

$(BUILDDIR)/%.o:$(SRCDIR)/%.cpp
	$(CC) $(CFLAGS) -c -o $@ $< -I$(INCDIR)

.PHONY: clean

clean:
	rm -f $(BUILDDIR)/*